<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<p:dialog id="dialogCadastroHist" modal="true" width="50%"
	position="top" appendTo="@(body)" closable="true" resizable="true"
	draggable="true" widgetVar="dialogCadastroHistoricoClinico"
	header="Histórico Cínico">
	<p:ajax event="close"
		listener="#{marcacaoConsultaMB.historicoMB.close}"
		update="frmDialogHistoricoClinico" />
	<h:form id="frmDialogHistoricoClinico">

		<h:panelGrid columns="2">

			<p:outputLabel value="Codigo:"></p:outputLabel>
			<p:inputText size="30"
				value="#{marcacaoConsultaMB.historicoMB.historicoClinicoSelecionado.codigo}"
				disabled="true"></p:inputText>

			<p:outputLabel value="Usuário:" for="usuario"></p:outputLabel>
			<p:inputText required="true" id="usuario" size="30"
				value="#{marcacaoConsultaMB.historicoMB.historicoClinicoSelecionado.usuario.nome}"
				disabled="true"></p:inputText>

			<p:outputLabel value="Data:" for="data"></p:outputLabel>
			<p:inputMask id="data"
				value="#{marcacaoConsultaMB.historicoMB.historicoClinicoSelecionado.data}"
				size="30" disabled="#{marcacaoConsultaMB.historicoMB.consultando}"
				required="true" requiredMessage="Data é obrigatória!" maxlength="80"
				mask="99/99/9999">
				<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
			</p:inputMask>

			<p:outputLabel value="Hora:" for="hora"></p:outputLabel>
			<p:inputMask id="hora"
				value="#{marcacaoConsultaMB.historicoMB.historicoClinicoSelecionado.hora}"
				size="30" disabled="#{marcacaoConsultaMB.historicoMB.consultando}"
				required="true" requiredMessage="Hora é obrigatória!" maxlength="80"
				mask="99:99" converter="horaConverter">

			</p:inputMask>

			<p:outputLabel value="Médico:" for="selectmed"></p:outputLabel>
			<p:selectOneMenu
				value="#{marcacaoConsultaMB.historicoMB.historicoClinicoSelecionado.medico}"
				required="true" id="selectmed" filter="true" style="width:400px"
				disabled="#{not marcacaoConsultaMB.historicoMB.incluindo}"
				converter="funcionarioConverter">
				<f:selectItems value="#{marcacaoConsultaMB.historicoMB.listaMedico}"
					var="med" itemLabel="#{med.dadosCadastro.nome}" itemValue="#{med}"></f:selectItems>
			</p:selectOneMenu>


			<p:outputLabel value="Animal:" for="selectanimal"></p:outputLabel>
			<p:selectOneMenu
				value="#{marcacaoConsultaMB.historicoMB.historicoClinicoSelecionado.animal}"
				required="true" id="selectanimal" filter="true" style="width:400px"
				disabled="#{not marcacaoConsultaMB.historicoMB.incluindo}"
				converter="animalConverter">
				<f:selectItem itemLabel="" itemValue="#{null}"></f:selectItem>
				<f:selectItems value="#{marcacaoConsultaMB.historicoMB.listaAnimal}"
					var="animal"
					itemLabel="#{animal.nomeAnimal} - cliente:#{animal.cliente.dadosCadastro.nome}"
					itemValue="#{animal}"></f:selectItems>
			</p:selectOneMenu>



			<p:outputLabel value="Observação:"></p:outputLabel>
			<p:inputTextarea id="obs"
				value="#{marcacaoConsultaMB.historicoMB.historicoClinicoSelecionado.observacao}"
				style="width:400px;height:200px"
				disabled="#{marcacaoConsultaMB.historicoMB.consultando}"
				autoResize="true" scrollHeight="210" maxlength="500"></p:inputTextarea>




		</h:panelGrid>
		<h:panelGrid columns="2" style="border:0px">
			<p:commandButton value="Confirma"
				actionListener="#{marcacaoConsultaMB.addHistorico}"
				rendered="#{not marcacaoConsultaMB.historicoMB.consultando}"
				update=":frm:tabelahistorico,:mensagem"
				oncomplete="validaDialog(args,'dialogCadastroHistoricoClinico','frmDialogHistoricoClinico:dialogCadastroHist')" />


			<p:commandButton value="Cancela"
				onclick="dialogCadastroHistoricoClinico.hide()" immediate="true" />

		</h:panelGrid>

	</h:form>
</p:dialog>

</html>